1. Field of the Invention
This invention relates generally to scheduling the tasks for a peripheral device in a data processing system during a power failure, and more specifically to scheduling the completion of tasks for a peripheral device during a power failure in a data processing system and after power is restored.
2. Description of the Prior Art
In many data processing systems (e.g., computer systems, programmable electronic systems, telecommunication switching systems, control systems, and so forth) a power failure may occur while a peripheral device is performing one or more tasks scheduled for that peripheral device.
FIG. 1 illustrates a prior art approach for handling power failures in a data processing system 100. Data processing system 100 includes an uninterruptible power supply (UPS) 106 that can briefly supply all the electrical power required to operate the core 102 of the data processing system and a peripheral device 104 (e.g., a printer or other I/O device). The UPS may or may not provide sufficient time for peripheral 104 to perform one or more scheduled tasks, such as printing one or more files. If the UPS does not provide sufficient time, then the tasks are not completed and are possibly deleted from the task queue for the peripheral. Furthermore, a larger data processing system requires a larger and more expensive UPS with a larger power capacity. It is often impractical to buy a UPS that can supply an entire data processing system, because the price and size of a higher capacity UPS rapidly increases for higher power capacities.
It would be desirable to have the capability to reliably insure that the occurrence of a power failure during the operation of a peripheral device in a data processing system will not prevent the completion of each scheduled peripheral task. It would also be desirable to provide an apparatus and method to handle power failures and the restoration of power without requiring a large and expensive UPS with the power capacity to supply power for an entire data processing system.
The invention provides the capability to help insure that the occurrence of a power failure during the operation of a peripheral device in a data processing system will not prevent the completion of each scheduled peripheral task.
The invention also provides an apparatus and method to handle power failures and the restoration of power without requiring a large and very expensive uninterruptible power supply with the capacity to supply power for an entire data processing system.
A first aspect of the invention is directed to a method to handle a power failure during the performance of a task by a peripheral device, wherein the peripheral device receives electrical power with an xe2x80x9conxe2x80x9d state and an xe2x80x9coffxe2x80x9d state from a power supply, and the peripheral device is part of a data processing system which also contains a non-volatile memory. The method includes monitoring the power supply to determine whether the electrical power is changing from the xe2x80x9conxe2x80x9d state to the xe2x80x9coffxe2x80x9d state, or changing from the xe2x80x9coffxe2x80x9d state to the xe2x80x9conxe2x80x9d state; if the electrical power is changing from the xe2x80x9conxe2x80x9d state to the xe2x80x9coffxe2x80x9d state, examining a first task queue for the peripheral device to find at least one task for the peripheral device in the first task queue; calculating the amount of electrical energy required for the task; performing the task if sufficient electrical energy remains available to the peripheral device to complete the task; and storing data describing the task in a second task queue in the non-volatile memory if insufficient electrical energy remains available to the peripheral device to complete the task.
A second aspect of the invention is directed to a data processing system that handles power failures when receiving electrical power with an xe2x80x9conxe2x80x9d state and an xe2x80x9coffxe2x80x9d state from a power supply. The data processing system includes an electrical detection circuit for monitoring the power supply to determine whether the electrical power is changing from the xe2x80x9conxe2x80x9d state to the xe2x80x9coffxe2x80x9d state, or changing from the xe2x80x9coffxe2x80x9d state to the xe2x80x9conxe2x80x9d state; a peripheral device, including a processor to calculate the amount of electrical energy required for the peripheral device to perform a task; a first task queue for the peripheral device that can be read to find a task for the peripheral device if the electrical power is changing from the xe2x80x9conxe2x80x9d state to the xe2x80x9coffxe2x80x9d state; and a non-volatile memory, including a second task queue for said peripheral device that can store data describing said task if insufficient electrical energy remains available to said peripheral device to complete said at least one task.